public class Solution {

public boolean isPalindrome(String s) {
        //将大写字母都转变成小写
        String str=s.toLowerCase();
        String res="";
        //变成字符数组
        char[] arr=str.toCharArray();
        for(char x:arr){
        //去掉非字母数字字符
        if((x>='a'&&x<='z')||x>='0'&&x<='9'){
        res=res+x;
        }
        }
        //前后指针验证是否是回文串
        int left=0;
        int right=res.length()-1;

        while(left<right){
        if(res.charAt(left)!=res.charAt(right)){
        return false;
        }
        left++;
        right--;

        }
        return true;
        }
        }